//Sun Jul 17 12:00:06 IST 2011
#include <stdio.h>

int main()
{
	int meetings[][2] = {{600, 2300},{1200, 1300},{700, 800}, {1200, 1400}, {600, 900}};

	int i,j,k,t,N=5;

	// sort by starting time
	for (i=0; i < N; i++) {
		for (j=i+1; j<N ;j++) {
			if (meetings[i][0] > meetings [j][0]) {
				for(k=0; k<2; k++) {
					t = meetings[i][k];
					meetings [i] [k] = meetings [j][k];
					meetings[j][k] = t;
				}
			}


		}
	}

	// find conflicts
	for (i=0;i<N; i++) {
		//printf("meeting [%d\t%d]\n", meetings[i][0], meetings[i][1]);

		for (j=i+1; j < N; j++) {
			if (meetings[j][0] < meetings[i][1])
				printf("Meeting collision: [%d, %d] & [%d, %d]\n", meetings[j][0], meetings[j][1], meetings[i][0], meetings[i][1]);
		}
	}
}
//Sun Jul 17 12:18:16 IST 2011
